/* eslint-disable jsdoc/no-restricted-syntax */
/**
 * @template T
 * @typedef {(a: T, b: T) => boolean} LessThan
 */

/**
 * @template Value
 * @template Priority=number
 */
class PriorityQueue {
  /** @type {LessThan<Priority>} */
  _comparePriority;

  /**
   * @param {LessThan<Priority>} [comparePriority]
   */
  constructor(comparePriority = (a, b) => a < b) {
    this._comparePriority = comparePriority;
    // ...
  }

  /**
   * @param {Value} value
   * @param {Priority} priority
   */
  add(value, priority) {
    // ...
  }

  /**
   * @returns {Value}
   */
  pop() {
    // ...
  }
}

/** @type {PriorityQueue<Person, [number, string]>} */
const queue = new PriorityQueue(compareByAgeThenAlphabetical);
